'use strict';
module.exports = app => {
  const { STRING, INTEGER, TEXT } = app.Sequelize;
    const model = app.model.define(
      'answer',
      {
          id: {type: INTEGER, primaryKey: true, autoIncrement: true},
          content: TEXT(),
          order_no: STRING(255),
          user_id: INTEGER(11),
      },
      {
          tableName: 'answer',
          timestamps: true, // 启用时间戳(createdAt, updatedAt)
          updatedAt: 'updated_time', // 不想要 updatedAt
          createdAt: 'create_time', // 想要  createdAt 但是希望名称叫做 created_at
      }
    );
    // 关联关系
    model.associate = function() {
        // 一对一user
        model.belongsTo(app.model.User, { foreignKey: 'user_id', targetKey: 'id' });
    }
    return model
};
